package com.hp.gxw.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hp.gxw.entity.ProcessPriceOrder;
import com.hp.gxw.entity.ProcessPriceProduce;
import com.hp.gxw.mapper.ProcessPriceOrderMapper;
import com.hp.gxw.service.IProcessPriceOrderService;
import com.hp.gxw.service.IProcessPriceProduceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author huangping
 * @since 2023-10-30
 */
@Service
public class ProcessPriceOrderServiceImpl extends ServiceImpl<ProcessPriceOrderMapper, ProcessPriceOrder> implements IProcessPriceOrderService {

    @Autowired
    private IProcessPriceProduceService iProcessPriceProduceService;

    @Autowired
    private ProcessPriceOrderMapper processPriceOrderMapper;

    @Override
    @Transactional
    public void deleteInfo(List<String> ids) throws Exception {
        removeBatchByIds(ids);
        iProcessPriceProduceService.remove(new LambdaQueryWrapper<ProcessPriceProduce>().in(ProcessPriceProduce::getOrderId, ids));
    }

    @Override
    public Page<ProcessPriceOrder> listType(Page<Object> objectPage, QueryWrapper<ProcessPriceOrder> queryWrapper) {
        return processPriceOrderMapper.listType(objectPage,queryWrapper);
    }

    @Override
    public  List<Map<String,Object>> getSaleReportList(QueryWrapper ew) {
        return processPriceOrderMapper.getSaleReportList(ew);
    }
}
